﻿@model NewsItemModel

@using SmartStore.Web.Models.News;

@{
    Layout = "_Layout";

    Html.AddTitleParts(!String.IsNullOrEmpty(Model.MetaTitle) ? Model.MetaTitle : Model.Title);
    Html.AddMetaDescriptionParts(Model.MetaDescription);
    Html.AddMetaKeywordParts(Model.MetaKeywords);
}

<article class="page news-item-page">
    <div class="news-date text-muted mb-1">
        @Model.CreatedOn.ToNativeString("D")
    </div>

    <div class="page-title mb-5">
        <h1 class="fs-h2">@Model.Title</h1>
    </div>

    <div class="news-body">    
        @{ Html.RenderWidget("newsitem_page_before_body"); }

        <div class="news-content text-body html-editor-content">
            @Html.Raw(Model.Full)
        </div>

        @{ Html.RenderWidget("newsitem_page_before_comments"); }

        @if (Model.Comments.AllowComments)
        {
			<div class="row">
				<div class="col-12 col-lg-8 offset-lg-2">
					<div class="block news-comment-form mt-5">
						@using (Html.BeginForm())
						{
							<fieldset class="news-comment-form content-group mt-5">
								<legend><span>@T("News.Comments.LeaveYourComment")</span></legend>
								
								@if (ViewContext.ViewData.ModelState.ContainsKey(""))
								{
									@Html.ValidationSummary(true)
								}

								<div class="form-group">
									@Html.TextBoxFor(model => model.AddNewComment.CommentTitle, new { @class = "form-control form-control-lg", placeholder = Html.DisplayNameFor(m => m.AddNewComment.CommentTitle) })
									@Html.ValidationMessageFor(model => model.AddNewComment.CommentTitle)
								</div>

								<div class="form-group">
									@Html.TextAreaFor(model => model.AddNewComment.CommentText, new { @class = "form-control form-control-lg", placeholder = Html.DisplayNameFor(m => m.AddNewComment.CommentText), rows = "6" })
									@Html.ValidationMessageFor(model => model.AddNewComment.CommentText)
								</div>

								@{ Html.RenderWidget("gdpr_consent"); }

								@if (Model.AddNewComment.DisplayCaptcha)
								{
									<div class="form-group">
										<div class="captcha-box">
											@Html.Raw(Html.GenerateCaptcha())
										</div>
									</div>
								}

								<div class="form-group">
									<button type="submit" name="add-comment" value="add-comment" class="btn btn-primary btn-lg">
										@T("News.Comments.SubmitButton")
									</button>
								</div>
							</fieldset>
						}
					</div>

					@{ Html.RenderPartial("Comment.List", Model.Comments); }
				</div>
			</div>
        }

        @{ Html.RenderWidget("newsitem_page_after_comments"); }
    </div>
</article>
